package cn.lovemmd.bms.mapper;

import cn.lovemmd.bms.pojo.Code;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.*;

@Mapper
public interface CodeMapper extends BaseMapper<Code> {
    @Insert("insert into bms_code(authorization_code,authority,is_use) values(#{code},#{authority},0)")
    Integer addCode(String code,String authority);
    @Delete("delete from bms_code where authorization_code=#{code}")
    Integer deleteCode(String code);
    @Update("update bms_code set is_use=1 where authorization_code=#{code}")
    void useCode(String code);
    @Select("select * from bms_code where authorization_code=#{code}")
    Code getCode(String code);
}
